package com.mxx.common.data.jpa.auditing;

import com.mxx.common.thread.FastThreadContext;

public class DeleteFlagThreadLocal {
    private static final String DELETE_FLAG_KEY = "mxx:common:data:deleteFlag:use";

    public static boolean isUse() {
        return (boolean) FastThreadContext.get(DELETE_FLAG_KEY).orElse(true);
    }

    public static void unUse() {
        FastThreadContext.set(DELETE_FLAG_KEY, false);
    }

    public static void use() {
        FastThreadContext.set(DELETE_FLAG_KEY, true);
    }

    public static void delete() {
        FastThreadContext.remove(DELETE_FLAG_KEY);
    }
}
